package cc.linker.steplink.crm.merchant.controller;

import cc.linker.steplink.crm.merchant.service.PlatformService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.util.List;
import java.util.Map;

@RestController
@RequestMapping("/platform")
public class PlatformController {

    @Autowired
    private PlatformService platformService;

    /**
     * @Description: 获取平台列表
     * @Return: java.util.List
     * @Author: ch
     * @Date: 2019/11/26 9:48
     * @Version: 1.11.10
     **/
    @GetMapping("/getPlatformList")
    public List getList(){
        return platformService.getList();
    }

    /**
     * @Description:  保存平台
     * @Param: platFormName 平台名称
     * @Param: platFormAlias 平台别名
     * @Param: linkId        关联id
     * @Return: void
     * @Author: ch
     * @Date: 2019/11/26 9:49
     * @Version: 1.11.10
     **/
    @PostMapping("/savePlatform")
    public void savePlatform(@RequestBody Map<String, Object> map){
        platformService.savePlatform(map);
    }

    /**
     * @Description: 删除平台
     * @Param: [platFormId 平台id]
     * @Return: void
     * @Author: ch
     * @Date: 2019/11/26 10:16
     * @Version: 1.11.10
     **/
    @PostMapping("/removePlatform")
    public void removePlatform(Long platFormId){
        platformService.removePlatform(platFormId);
    }

    /**
     * @Description: 平台详情
     * @Param: [platFormId 平台id]
     * @Return: java.util.Map<java.lang.String,java.lang.Object>
     * @Author: ch
     * @Date: 2019/11/26 11:16
     * @Version:
     **/
    @GetMapping("/getPlatformInfo")
    public Map<String, Object> getPlatformInfo(Long platFormId){
       return platformService.getPlatformInfo(platFormId);
    }



    /**
     * @Description: 入驻列表
     * @Param: [platFormId 平台id]
     * @Return: java.util.List
     * @Author: ch
     * @Date: 2019/11/26 10:40
     * @Version: 1.11.10
     **/
    @GetMapping("/getBussinessList")
    public List getBussinessList(Long platFormId){
        return  platformService.getBussinessList(platFormId);
    }


    /**
     * @Description: 新增入驻
     * @Param: platFormId 平台id
     * @Param: bussinessName 企业名称
     * @Param: bussinessAccount 商户支付号
     * @Return: void
     * @Author: ch
     * @Date: 2019/11/26 10:44
     * @Version: 1.11.10
     **/
    @PostMapping("/saveBussiness")
    public void saveBussiness(@RequestBody Map<String, Object> map){
        platformService.saveBussiness(map);
    }


    /**
     * @Description: 移除入驻
     * @Param: bussinessAccount 商户支付号
     * @Param: platFormId 商户支付号
     * @Return: void
     * @Author: ch
     * @Date: 2019/11/26 11:08
     * @Version: 1.11.10
     **/
    @PostMapping("/removeBussiness")
    public void removeBussiness(@RequestBody Map<String, Object> map){
        platformService.removeBussiness(map);
    }
}
